<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>
<script type="text/javascript" src="<c:url value="/js/plugins/piexif.js"/>"></script>
<div class="content">
	<div class="box">
		<div class="box-body">
			<sf:form servletRelativeAction="/manager/banner/add" method="post" modelAttribute="bannerInfo" cssClass="submitForm" enctype="multipart/form-data">
				<div class="form-group">
					<label>标题</label>
					<div>
						<sf:input path="title" cssClass="form-control"/>
					</div>
					<sf:hidden path="imagerContent"/>
				</div>
				
				<div class="form-group">
					<label>图片路径</label>
					<div >
						<div class="file-loading">
							<input type="file" class="file" name="multipartFile" id="input-image-1" accept="image/*">
						</div>
					</div>
					<div id="kv-success-modal" class="modal fade">
						<div class="model-dialog"></div>
							<div class="modal-content">
								<div class="modal-header">
									<h4 class="modal-title">Yippee!</h4>
								</div>
								<div id="kv-success-box" class="modal-body">
							
								</div>
							</div>
					</div>
				</div>

				<div class="form-group">
					<label>目标地址:</label>
					<div>
						<sf:input path="targetUrl" cssClass="form-control"/>
					</div>
				</div>

				<div class="form-group">
					<button type="submit" class="btn btn-primary">保存</button>
				</div>
			</sf:form>
		</div>
	</div>
</div>
<script type="text/javascript">
	$("#input-image-1").fileinput({
		language:'zh',
		uploadUrl:'<c:url value="/uploader/image?imageInfo=banner"/>',
		allowedFileExtensions:['jpg','png','gif'],
		maxFileCount:1,
		resizeImage:true
	}).on('filepreupload',function(){
		$("#kv-success-box").html('');
	}).on('fileuploaded',function(event,data){
		$("#imagerContent").val(data.response.id);
		$("#kv-success-box").append(data.response.link);
		$("#kv-success-modal").modal('show');
	});
</script>
